home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir43 / med300.zip / MEWORD.CLA < prev   
Text File  |  1994-02-22  |  3KB  |  69 lines

  1.  
  2. !▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  3. !█                                     █
  4. !█ MEWORD.CLA                                                            █
  5. !█ Word-by-word movement                                                 █
  6. !█                                     █
  7. !█ Revision Number: 1                             █
  8. !█ Revision Date  : 22-Feb-94                                            █
  9. !█                                     █
  10. !█ Revision History                             █
  11. !█   1 Created                                 █
  12. !█                                     █
  13. !▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  14.  
  15.              MEMBER('MEMOEDIT')
  16.  
  17. !═════════════════════════════════════════════════════════════════════════
  18. !           Search for previous word in document
  19. !═════════════════════════════════════════════════════════════════════════
  20. ME_WordLeft  FUNCTION( isPosition )
  21.  
  22.          ! Locals:
  23. ubChar       BYTE                                ! Character code
  24.  
  25.   CODE
  26.   IF isPosition                     ! If not at first position
  27.     isPosition -= 1                 !   Adjust position
  28.     LOOP WHILE isPosition >= 0             !   Loop
  29.       ubChar = ME_GetChar(isPosition)            !     Get character code
  30.       IF INRANGE(ubChar, 21H, 0FEH) THEN BREAK.  !     Break on non-whitespace
  31.       isPosition -= 1                 !     Decrement position
  32.     .                         !   End if
  33.     LOOP WHILE isPosition >= 0             !   Loop
  34.       ubChar = ME_GetChar(isPosition)            !     Get character code
  35.       IF ~INRANGE(ubChar, 21H, 0FEH) THEN BREAK. !     Break on whitespace
  36.       isPosition -= 1                 !     Decrement position
  37.     .                         !   End loop
  38.     isPosition += 1                 !   Adjust position
  39.   .                         ! Endif
  40.   RETURN(isPosition)                 ! Return start of prev word
  41.  
  42.  
  43. !═════════════════════════════════════════════════════════════════════════
  44. !             Search for next word on line
  45. !═════════════════════════════════════════════════════════════════════════
  46. ME_WordRight FUNCTION( isPosition )
  47.  
  48.          ! Locals:
  49. ubChar       BYTE                                ! Character code
  50.  
  51.   CODE
  52.   LOOP                         ! Loop
  53.     ubChar = ME_GetChar(isPosition)              !   Get character code
  54.     IF NOT ubChar THEN BREAK.                    !   Break if past last char
  55.     IF ~INRANGE(ubChar, 21H, 0FEH) THEN BREAK.   !   Break on whitespace
  56.     isPosition += 1                 !   Increment position
  57.   .                         ! End if
  58.   LOOP                         ! Loop
  59.     ubChar = ME_GetChar(isPosition)              !   Get character code
  60.     IF NOT ubChar THEN BREAK.                    !   Break if past last char
  61.     IF INRANGE(ubChar, 21H, 0FEH) THEN BREAK.    !   Break on non-whitespace
  62.     isPosition += 1                 !   Increment position
  63.   .                         ! End loop
  64.   IF NOT ubChar                                  ! If past last char
  65.     isPosition = -1                 !   Return invalid position
  66.   .                         ! Endif
  67.   RETURN(isPosition)                 ! Return start of next word
  68.  
  69.